$(function(){

});

// 设置限定来源
function changeRestrictSource(obj, id, restrictSource) {
	
	var _obj = $(obj);
	
	var param = {
		"id" : id,
		"restrictSource" : restrictSource
	};
	API.elementChangeRestrictSource(param, function(res) {
		if(res.code == 0) {
			if(res.data.delFlag == "1") {
				_obj.removeAttr("style");
			} else {
				_obj.css("background-color","#82ded8;");
			}
		} else {
			alert(res.desc);
		}
	});
}


function submitPage(obj) {
	if(UTIL.checkButton(obj)) {
		var ids = "";
		$(".data_id").each(function() {
			ids += $(this).val() + ",";
		});
		ids = ids.substring(0, ids.length-1);
		
		var param = { "ids": ids }
		API.elementSourceSubmitPage(param, function(res) {
			if(res.code == 0) {
				window.location.reload();
			} else {
				alert(res.desc);
				UTIL.releaseButton(obj);
			}
		});
	}
}

function refresh(obj) {
	if(UTIL.checkButton(obj)) {
		API.elementSourceRefresh(function(res) {
			if(res.code == 0) {
				window.location.reload();
			} else {
				alert(res.desc);
				UTIL.releaseButton(obj);
			}
		});
	}
}
